//app.js
let api = require('./utils/api.js');
let req = require('./utils/request.js');
let Towxml = require('/towxml/main');

App({
  onLaunch: function () {

  },
  towxml: new Towxml(),
  globalData: {
    userInfo: null
  },
  login: function(data, callback) {
    wx.login({
      success: function (res) {
        data.code = res.code
        console.info(data);
        req.request(
          api.login, 
          {'method': 'POST', data: data},
          function(res) {
            //执行回调
            callback(res);
          }
        );
      }
    })
  }
})